/*************************************************
* Title：TinyToolKit
* Author：Opportunity 
* Discribe：定义计时任务的基类
* CreateTime：2020-04-05 20:21:58
* Version：1.0
* Modify Recoder：
*************************************************/
using System;

namespace TinyToolKit.Timer
{
    public class BaseTimerTask
    {
        public int taskID;
        public Action callback;
        public int repeatCount;
        public TaskState taskState = TaskState.None;
    }

    public class TimerTask: BaseTimerTask
    {
        public float destTime;
        public float duration;
        public bool ignoreTimeScale;

        public TimerTask() { }

        public TimerTask(int taskID,Action callback, float destTime,float duration,int repeatCount,bool ignoreTimeScale)
        {
            this.taskID = taskID;
            this.callback = callback;
            this.destTime = destTime;
            this.duration = duration;
            this.repeatCount = repeatCount;
            this.ignoreTimeScale = ignoreTimeScale;
            this.taskState = TaskState.Running;
        }
    }

    public class TimerTaskByFrame: BaseTimerTask
    {
        public int destFrame; 
        public int frameCount;

        public TimerTaskByFrame() { } 

        public TimerTaskByFrame(int taskID, Action callback, int destFrame, int frameCount, int repeatCount)
        {
            this.taskID = taskID;
            this.callback = callback;
            this.destFrame = destFrame;
            this.frameCount = frameCount;
            this.repeatCount = repeatCount;
            taskState = TaskState.Running;
        }
    }

    public enum TimerUnit
    {
        Millisecond,//毫秒
        Second,//秒
        Minute,//分
        Hour,//时
        Day//天
    }

    public enum TaskState
    {
        None,//当前任务不存在
        Running,//正在运行
        Paused//暂停状态
    }
}
